package tr.com.netgis.util;

import java.util.Calendar;

import tr.com.netgis.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class EulaUtils {


	  private static final String EULA_PREFERENCE_FILE = "eula";

	  // Accepting Google mobile terms of service
	  private static final String EULA_PREFERENCE_KEY = "mts.tos_accepted";

	  private EulaUtils() {}

	  public static boolean getEulaValue(Context context) {
	    SharedPreferences sharedPreferences = context.getSharedPreferences(
	        EULA_PREFERENCE_FILE, Context.MODE_PRIVATE);
	    return sharedPreferences.getBoolean(EULA_PREFERENCE_KEY, false);
	  }

	  public static void setEulaValue(Context context) {
	    SharedPreferences sharedPreferences = context.getSharedPreferences(
	        EULA_PREFERENCE_FILE, Context.MODE_PRIVATE);
	    Editor editor = sharedPreferences.edit();
	    editor.putBoolean(EULA_PREFERENCE_KEY, true);
	    editor.commit();
	  }

	  public static String getEulaMessage(Context context) {
	    return context.getString(R.string.eula_message_date) 
	        + "\n\n"
	        + context.getString(R.string.eula_message_item4) 
	        + "\n\n" 
	        + "Â©" + Calendar.getInstance().get(Calendar.YEAR);
	  }

}
